<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		
		<meta name="description" content="小霸王在线玩，品位经典">
		<meta name="keywords" content="小霸王在线玩，fc，nes，在线小霸王游戏">
		<meta name="robots" content="index, follow">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		  <!-- 引入样式文件 -->
		  <link rel="stylesheet" href="../../js/vant2.2/index.css">
		  
	
	
		<meta name="author" content="IT_迁哥">
		<title>千千万能工具箱-在线小霸王游戏H5</title>
	</head>
	<body>
		
		<div id="app">
	
			<div style="margin: 1%;">
				<el-input id="name" v-model="name" placeholder="请输入游戏名称" @Input="search()" ></el-input>
		

			</div>
			<div v-loading="loading">
				<van-cell-group>
			<van-cell @click="openGame(item.id)" :title="item.name" :value="'已玩次数:'+item.playCount" :label="item.isSupport==0?'支持该游戏':'不支持该游戏'" v-for="item in sourceData" />
			</van-cell-group>
			</div>
			
	</body>

	<script src="../../js/jquery.min.js"></script>
	<script src="../../js/vue2.6.11/vue.js"></script>
	<link rel="stylesheet" href="../../js/element2.4.7/index.css" />
	<script src="../../js/element2.4.7/index.js"></script>
		  <script src="../../js/vant2.2/vant.min.js"></script>
	<script>
		const cacheKey="qqgjx:fc:h5:game"
		const baseUrl = "https://api.lqcpws.cn"
		// const baseUrl = "http://192.168.1.121:8848"

		// const gameUrl = "http://192.168.1.121:10001/qqgjx-private-nes/index.html?id="
		
			const gameUrl = "https://www.lqcpws.cn/nes/mobile.html?id="
		const app = new Vue({
			el: '#app',
			data: {

				title: '',
				sourceData: [],
				showData: [],
				name: "",
				page: 1,
				limit: 10,
				total: 0,
				loading:false,

			},
			mounted() {
			let name=localStorage.getItem(cacheKey)
			if(name!=undefined){
				this.name=name
			}
				$.ajax({
					type: 'get',
					url: baseUrl + "/pc/requestCountByDay",
					success: function(res) {


					}
				})
				this.pageData()


		this.$message.success('欢迎游玩免费fc游戏！如有加载不出来，可能是h5不支持！')
			},
			methods: {
				search(){
					localStorage.setItem(cacheKey,this.name)
					this.loading=true
					this.sourceData=[]
					
					this.page=1
					this.pageData()
				},
				getBase64Data(url,zindex) {
					let data = undefined
					$.ajax({
						async: true,
						url: url==undefined?'https://lqcpws.cn/tinyfile/1698735727254.txt':url,
						success(res) {
							document.getElementById(zindex).src=res
						}

					})
			
				},
				openGame(id) {
					window.open(gameUrl + id, '_blank')
				},
				currentPage(value) {
					this.page = value
					this.pageData()
				},
				splitList(data, limit) {
					let size = data.length % limit == 0 ? data.length / limit : parseInt(data.length / limit) + 1
					let dataArray = []
					let start = 0
					for (let i = 0; i < size; i++) {
						let tempArray = []
						for (let j = 0; j < limit; j++) {
							if (start < data.length) {
								tempArray.push(data[start++])
							} else {
								break;
							}
						}
						dataArray.push(tempArray)
					}
					return dataArray;
				},
				pageData() {
					let _this = this
					$.ajax({
						type: 'get',
						url: baseUrl + "/pc/nesGame/getNesGamePage",
						data: {
							page: _this.page,
							limit: _this.limit,
							name: _this.name
						},
						success: function(res) {
							res.data.forEach(item=>{
								_this.sourceData.push(item)
							})
							console.log(_this.sourceData)
							_this.loading=false
							


						}
					})

				},



			}
		})
		
		
var startY, moveY;

document.addEventListener('touchstart', function(event) {
  startY = event.touches[0].clientY;
});

document.addEventListener('touchmove', function(event) {
  moveY = startY - event.touches[0].clientY;

  if (moveY > 0 && moveY <= 50 && window.innerHeight + window.pageYOffset >= document.body.offsetHeight - 50) {
    // 用户正在向上拖动且离底部不超过 20px
    // 在这里可以执行相应的操作
	console.log("50")
	app.page++;
	app.pageData()
  }
});

document.addEventListener('touchend', function(event) {
  // 手指离开屏幕
  // 在这里可以执行相应的操作
});
	</script>
</html>
